
/**
 * monitorstat-time-web
 */
package com.taobao.askwho.utils.session;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.taobao.askwho.po.UserInfo;


/**
 * @author xiaodu
 *
 * 下午2:28:54
 */
public class SessionUtil {
	
	private static String SESSION_KEY="~$session$~";
	
	
	public static UserInfo getUserInfo(HttpServletRequest request){
		HttpSession session = request.getSession(true);
		Object obj = session.getAttribute(SESSION_KEY);
		if(obj != null&&obj instanceof UserInfo){
			return (UserInfo)obj;
		}
		return null;
	}
	
	
	public static void setUserInfo(HttpServletRequest request,UserInfo po){
		HttpSession session = request.getSession(true);
		session.setAttribute(SESSION_KEY, po);
	}

}
